//
//  LBMEmoticon.swift
//  EmoticonKeyboard
//
//  Created by 刘保满 on 16/5/30.
//  Copyright © 2016年 itheima. All rights reserved.
// 单个表情模型

import UIKit

class LBMEmoticon: NSObject {
    
    //分组文件名称
    var id: String?
    
    //在向服务器发送表情的时候传递文本
    var chs: String?
    
    //显示在文本输入框中的图片
    var png: String? {
        
        didSet {
            //给imagePath赋值
             imagePath = NSBundle.mainBundle().bundlePath + "/Emoticons.bundle/" + "\(id!)/" + "\(png ?? "")"
        }
        
    }
    //图片的绝对路径
    var imagePath: String?
    
    var code: String? {
        
        didSet {
            
            emojiStr = code?.emojiStr()
            
        }
        
    }
    //增加emojiStr一个字符属性
    var emojiStr: String?
    
    //标记是否是删除按钮的模型
    var isDelete = false
    
    //标记是否是空白按钮的模型
    var isEmpty = false
    
    init(id: String,dict: [String: String]) {
        self.id = id
        super.init()
        
        setValuesForKeysWithDictionary(dict)
        
    }
    
    init(isDelete: Bool) {
        super.init()
        self.isDelete = isDelete
    }
    
    init(isEmpty: Bool) {
        super.init()
        self.isEmpty = isEmpty
        
    }
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
        
        
    }
    
    
    override var description: String {
        
        let keys = ["chs","png","code","emojiStr"]
        let dict = self.dictionaryWithValuesForKeys(keys)
        return dict.description
    }
    

}
